// SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
// SPDX-License-Identifier: Mulan PSL v2
package com.geniusai.aip.auth.config;

import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hml14563
 * @date 2021/5/6
 */
@Configuration
public class K8sConfiguration {

    @Bean
    public KubernetesClient k8sClient() {
        return new DefaultKubernetesClient();
    }

    @Bean
    public CustomResourceDefinitionContext profileContext() {
        return new CustomResourceDefinitionContext.Builder().withGroup("kubeflow.org").withName("profiles.kubeflow.org").withPlural("profiles").withScope("Cluster").withVersion("v1beta1").build();
    }

    @Bean
    public CustomResourceDefinitionContext envoyFilterContext() {
        return new CustomResourceDefinitionContext.Builder().withGroup("networking.istio.io").withName("envoyfilters.networking.istio.io").withScope("Namespaced").withKind("EnvoyFilter")
                .withPlural("envoyfilters").withVersion("v1alpha3").build();
    }
}
